const { DataTypes } = require('sequelize');
const { sequelize } = require('../config/database');

const Poi = sequelize.define('Poi', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  name: {
    type: DataTypes.STRING(255),
    allowNull: false,
    comment: 'POI名称'
  },
  type: {
    type: DataTypes.STRING(100),
    allowNull: true,
    comment: 'POI类型'
  },
  location: {
    type: DataTypes.STRING(50),
    allowNull: false,
    comment: '坐标位置'
  },
  address: {
    type: DataTypes.TEXT,
    allowNull: true,
    comment: '地址'
  },
  distance: {
    type: DataTypes.INTEGER,
    allowNull: true,
    comment: '距离（米）'
  },
  tel: {
    type: DataTypes.STRING(50),
    allowNull: true,
    comment: '电话'
  },
  website: {
    type: DataTypes.STRING(255),
    allowNull: true,
    comment: '网站'
  },
  email: {
    type: DataTypes.STRING(100),
    allowNull: true,
    comment: '邮箱'
  },
  pcode: {
    type: DataTypes.STRING(20),
    allowNull: true,
    comment: '省份编码'
  },
  citycode: {
    type: DataTypes.STRING(20),
    allowNull: true,
    comment: '城市编码'
  },
  adcode: {
    type: DataTypes.STRING(20),
    allowNull: true,
    comment: '行政区划代码'
  },
  business_area: {
    type: DataTypes.STRING(100),
    allowNull: true,
    comment: '商圈'
  },
  rating: {
    type: DataTypes.DECIMAL(3, 1),
    allowNull: true,
    comment: '评分'
  },
  photos: {
    type: DataTypes.TEXT,
    allowNull: true,
    comment: '照片URL（JSON格式）'
  }
}, {
  tableName: 'poi',
  comment: 'POI信息表'
});

module.exports = Poi; 